home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / CGAMEJOY.ARJ / JOYSTICK.H < prev    next >
C/C++ Source or Header  |  1992-01-08  |  4KB  |  84 lines

  1. /* joystick.h       defines and prototypes for the joystick functions in...
  2.  
  3.                     joystklo.c: Low level game-adapter port access functions.
  4.                     joystkmd.c: Middle level joystick functions for joystklo.c.
  5.  
  6.                 See joystklo.se & joystkmd.se for pseudo code/structured english
  7.                 and joystick.doc for an explanation of the functions.
  8.  
  9.                 This module has been released to the public domain
  10.                         Tue  01-07-1992   23:30:18
  11.                 by Ed Torgerson : CIS 70313,456,  GEnie E.TORGERSON1.
  12.                 any constructive correspondence is welcome.
  13.  
  14. -----------------------------------------------------------------------------*/
  15.  
  16. #ifndef __JOYSTICK_H__
  17. #define __JOYSTICK_H__
  18.  
  19. /* return values for JstGetChangedButton and JstGetButton */
  20.  
  21. #define JA1_BUTTON_DOWN        16       /* joystick A, button 1, down */
  22. #define JA1_BUTTON_UP           1       /* joystick A, button 1, up   */
  23. #define JA2_BUTTON_DOWN        32       /* joystick A, button 2, down */
  24. #define JA2_BUTTON_UP           2       /* joystick A, button 2, up   */
  25.  
  26. #define JB1_BUTTON_DOWN        64       /* joystick B, button 1, down */
  27. #define JB1_BUTTON_UP           4       /* joystick B, button 1, up   */
  28. #define JB2_BUTTON_DOWN       128       /* joystick B, button 2, down */
  29. #define JB2_BUTTON_UP           8       /* joystick B, button 2, up   */
  30.  
  31. #define J_ANY_BUTTON_DOWN    0xf0       /* any button down: either joystick */
  32.  
  33. #define J_A_BUTTON_DOWN      0x30       /* any button down: joystick A */
  34. #define J_B_BUTTON_DOWN      0xC0       /* any button down: joystick B */
  35.  
  36. #define J_BUTTON_1_DOWN      0x50       /* button 1 down: either joystick */
  37. #define J_BUTTON_2_DOWN      0xA0       /* button 2 down: either joystick */
  38.  
  39. /* values to be passed to JstGetPosition */
  40.  
  41. #define JAX_AXIS                1       /* x axis mask for joystick A */
  42. #define JAY_AXIS                2       /* y axis mask for joystick A */
  43. #define JBX_AXIS                4       /* x axis mask for joystick B */
  44. #define JBY_AXIS                8       /* y axis mask for joystick B */
  45.  
  46. /* values for stick parameter to be passed to functions in joystkmd.c */
  47.  
  48. #define JOYSTICK_A              3       /* axis mask for joystick A */
  49. #define JOYSTICK_B           0x0C       /* axis mask for joystick B */
  50.  
  51. /* joystick position structure to be passed to functions in joystkmd.c */
  52.  
  53.  struct JoystickPosition {
  54.          int         jx  ;       /* joystick x-coordinate value */
  55.          int         jy  ;       /* joystick y-coordinate value */
  56.  } ;
  57.  
  58. /*-- Function Prototypes from joystklo.c -----*/
  59.  
  60. int  JstGetChangedButton( void ) ;
  61. int  JstGetButton ( void ) ;
  62. int  JstGetPosition ( int axis ) ;
  63. int  JstDetect ( void ) ;
  64. int  JstGetValidAxes ( void ) ;
  65. int  JstGetActiveAxes ( void ) ;
  66. int  JstSetActiveAxes ( unsigned mask ) ;
  67.                                      
  68. /*-- Function Prototypes from joystkmd.c -----*/
  69.  
  70. int  JstInitialize ( void (*NotifyUserFunc)(int) ) ;
  71. int  JstGetChangedPosition ( int stick, struct JoystickPosition *stickpos ) ;
  72. int  JstSetCenter ( int stick ) ;
  73. int  JstSetMin( int stick ) ;
  74. int  JstSetMax( int stick ) ;
  75. void JstGetCenter( int stick, struct JoystickPosition *jpos ) ;
  76. void JstGetMin( int stick, struct JoystickPosition *jpos ) ;
  77. void JstGetMax( int stick, struct JoystickPosition *jpos) ;
  78. void JstXlatToCart ( int stick, struct JoystickPosition *stickpos ) ;
  79. int  JstGetTolerance ( void ) ;
  80. void JstSetTolerance ( int tolerance ) ;
  81.  
  82. #endif
  83. /*-- end joystick.h -----*/
  84.